package com.fzy.silntgym.weight.MSfab.fragments;

import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.fzy.silntgym.R;
import com.fzy.silntgym.weight.MSfab.adapters.FavoritesNotesAdapter;


public abstract class FavoritesNotesListFragment extends Fragment {

    @LayoutRes
    protected abstract int getLayoutResId();

    protected abstract int getNumColumns();

    protected abstract int getNumItems();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getLayoutResId(), container, false);

        // Setup list
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.notes_list_favorite);
        if(recyclerView != null) {
            recyclerView.setLayoutManager(new StaggeredGridLayoutManager(getNumColumns(), StaggeredGridLayoutManager.VERTICAL));
            recyclerView.setAdapter(new FavoritesNotesAdapter(getActivity(), getNumItems()));
        }
        return view;
    }

}
